<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        /*
        使用一个构造函数创建一个square对象，对象包含属性width,height,color。对象有方法getArea，得到面积，以及getColor返回颜色。
        */
        //Person构造函数为空

        function Rectangle(width,height,color){
            this.width = parseInt(width)
            this.height = height
            this.color = color

            this.getArea = function(){
                return this.width*this.height
            }
            this.getColor = function(){
                return this.color
            }
            
        }
       
        let r1 = new Rectangle('200px',100,'red')
        
    </script>
</body>

</html>